package com.boot.service;

import com.boot.entity.User;
import com.boot.mapper.UserMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

//动态代理有哪些?
//cglib、jdk
//cglib:当没有使用接口的时候 Spring是使用cglib
//jdk:当使用接口的时候 Spring是使用JDK动态代理
@Service
public class UserService {

    @Autowired
    UserMapper userMapper;

    public List<User> list(){
        return userMapper.list();
    }

    public List<User> listJoin(){
        return userMapper.listJoin();
    }

    public List<User> listOneToOneAndOneToMany(){
        return userMapper.listOneToOneAndOneToMany();
    }

    public User getUserById(Long id){
        return userMapper.getUserById(id);
    }

    public User getUserByIdOneToMany(Long id){
        return userMapper.getUserByIdOneToMany(id);
    }

    public List<User> getUserByUserNameAndPassword(String userName,String password){
        return userMapper.getUserByUserNameAndPassword(userName,password);
    }

    public List<User> getUserByUserNameAndPasswordOneToMany(String userName,String password){
        return userMapper.getUserByUserNameAndPasswordOneToMany(userName,password);
    }


}
